using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public enum AnimaState{
    None,
    Stay,
    Damage,
    Move,
    Dead,
}
//暴露实体状态供动画系统使用
public class EntityAnimaMapper : MonoBehaviour
{
    public Entity entity;
    public AnimaState state = AnimaState.None;
    private void OnEnable() {
        if(entity != null){
            entity.processEvent.AddListener(()=>{
                if(entity.toward.magnitude > 0){
                    state = AnimaState.Move;
                }else{
                    state = AnimaState.Stay;
                }
            });
            entity.damageEvent.AddListener((e,d)=>{
                state = AnimaState.Damage;
            });
            entity.deadEvent.AddListener(e=>{
                state = AnimaState.Dead;
            });
        }    
    }
}
